var app = getApp();
var iFDU = require('../../utils/iFDU.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    config: app.config,
    globalData: app.globalData,
    screenWidth: 0,
    screenHeight: 0,
    redbags: [],
    emptyPageData: {
      message: '没有任何红包',
      buttonText: '返回',
      buttonEvent: 'goBack'
    },
    redbagId: 0,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    wx.showLoading({
      title: '加载中',
    });
    app.getUserInfo(function (globalData) {
      that.setData({
        globalData: globalData
      });

      iFDU.api.doGet(
        'redbag/getRealRedbagList',
        {
          userId: globalData.userId,
        },
        function (data) {
          that.setData({
            redbags: data
          });
          wx.hideLoading();
        }
      );
    });
  },

  goBack: function (e) {
    wx.navigateBack({
    });
  },

  onShareAppMessage: function (res) {
    var that = this;
    return {
      title: '爱上衬衫，从「逸见」开始…',
      imageUrl: 'http://s.i-fdu.com/runto/wxa/s/yjshare.jpeg',
      path: 'pages/home/home',
      success: function (res) {
      },
      fail: function (res) {
      }
    }
  }
})